package nayasis.study.pattern.observer;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Observable;

public class EventSource extends Observable implements Runnable {

	public void run() {

		InputStreamReader isr = new InputStreamReader( System.in );
		
		BufferedReader    br  = new BufferedReader( isr );
		
		String inputString    = null;

		while( true ) {

			try {

				inputString = br.readLine();
				
				setChanged();
				
				notifyObservers( inputString );
				
				
			} catch (IOException e) {
				e.printStackTrace();
			}
			
		}
		
	}

}
